<%--
  Created by IntelliJ IDEA.
  User: MGL
  Date: 2020/10/12
  Time: 15:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>分页</title>
    <link rel="stylesheet" href="../lib/layer/ui/css/layui.css" media="all">
    <script type="text/javascript" src="../lib/layer/ui/layui.js"></script>
</head>
<body>
<div id="test">

</div>

<script>
    layui.use('laypage', function(){
        var laypage = layui.laypage;

        //执行一个laypage实例
        laypage.render({
            elem: 'test'
            ,count: ${page.total} //数据总数，从服务端得到
            ,limits:[5,10,15]
            ,curr:${page.current}
            ,limit:${page.size}
            ,layout: ['prev', 'page', 'next', 'limit', 'skip','count']
            ,jump: function(obj, first){
                //obj包含了当前分页的所有参数，比如：
                console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                console.log(obj.limit); //得到每页显示的条数

                var a;
                //首次不执行
                if(!first){
                    //do something
                    location.href="${url}?current="+obj.curr+"&size="+obj.limit;
                    // location.href="getEmp/getEmpList/"+obj.curr+"/"+obj.limit;
                }
            }
        });
    });
</script>

</body>
</html>
